**Final Report** Student name: Xinyi Dong Netid: F00704b (#) Image based lighting I followed the book pbrt's image infinite lighting to implement my environment lighting. First I created a simple scene with with no lighting but only background lighting. (##) environment First it only has one method that reveives a direction, and return the radiance of that direction on the environment map.
Before After
(##) next event estimation and MIS Then I want to add the next event estimation to the background. But we also have other light sources in our scene, and always sampling the background does not seems wise. Therefore I add a ```sample_emitter```method in scene to sample either background or light with a probability. The pdf will be the original sample method pdf multiplies this probability. In this case, when we do nee in path tracer, we will sample from either background or lights, based on their pdf. I followed the class slides to do a full disbutrtion, using the luminance of the environment map, weighted by sin(θ) ; I also follow the pbrt to make a compensated distribution, which is derived by subtracting the average luminance of the map from each pixel's luminance. And any resulting negative values are clamped to zero. It is better for the nee computation because it reinforeces the bright areas. The other thing I did is to create a spherical bounds of our scene. which helps later in calculating the transmittance in the volume rendering. (##) interpolation Next thing I did is the interpolation. When background has low resolution, my rendering looks mosaic. Therefore we also need to looks at the neighbor points to get average values.
Before After
(#) Participating media First I started with homogeneous media and simple volume path tracer. Then extended to the full volume path tracer and nanovdb media. (##) Homogeneous media and simple volume path tracer First I created a simple path tracer that accept volume and I tested it with the vacuum media. The result should be the same with the path tracer mats. Then I followed basecode of homogeneous media. I used free-flight sampling, where distances are sampled based on the medium's extinction coefficient. Additionally, the transmittance is calculated in total_transmittance using the Beer-Lambert law. I first test with absorbtion media. Then I tested with scattering.
Vacuum mats
0.01 0.1 0.5 0.9
(##) Phase function
g = -0.9 g = +0.9 g = 0
(##) NEE + MIS After that, I added next event estimation and mis the lighting sample with phase/bsdf sample. Basically I followed the structure in mis path tracer. The result of sample free flight will determine if we are mis sample light and bsdf, or light and phase function.
before after
128spp
(##) background Then I integrate the background lighting I did before into the volume path tracer. When doing the light sampling, we mis sample the emitters and the background (##) nanovdb Then I started to work with the nanovdb media. First I only focused on the density. Similar with homogeneous, I used sample free flight based on the medium's maximum extinction coefficient. Then we get coeeficients at current point. We can then get the probability of the null scattering. For the total transmittance, we need to do the delta tracking to approximate the transmittance. After it worked with density. I add a color grib that my vdb file has. At each point, we calculate the coefficients based on density and colors.
Before After
Before After After Color
(#) Parallel rendering Basically I followed parallel.h and book pbrt. (##) Partitioning the image into tiles Tiles are created dynamically, ensuring optimal load balancing across threads. ``` const int num_threads = 8; Box2i extent(Vec2i(0, 0), Vec2i(image.width(), image.height())); int tileSize = clamp( int(std::sqrt(extent.diagonal().x * extent.diagonal().y / 8)), 1, 32); ``` (##) processing tiles in parallel loop Then we can process the tile sychronizely within the parallel for loop.
Before After
``` Automatically setting number of threads in thread pool to 24. Parsing scene ... registering material with name white registering material with name red registering material with name green registering material with name light registering material with name redsphere registering material with name greensphere Building BBH │██████████████████████████████████████████████████████████████████████████████████████████████████████████│ (0ms) BBH contains 8 surfaces. done parsing scene. Will save rendered image to "../../../scenes\assignment3\constant-cornell-box-2024-10-15-14-50-13.png" Rendering │█████████████████████████████████████████████████████████████████████████████████████████████████████████████│ (1m:15s) ——————————————————————————————————————————————————————————————————————————————————————————————— Statistics: ——————————————————————————————————————————————————————————————————————————————————————————————— BBH Interior nodes 7 Leaf nodes 8 Nodes visited per ray 1204845689 / 174198551 (6.92x) Integrator Camera rays traced 26214400 Intersections Quad intersection tests per hit 788582989 / 136245926 (5.79x) Sphere intersection tests per hit 206772925 / 21132592 (9.78x) Total intersection tests per ray 995355914 / 174198551 (5.71x) Scene Materials 6 Surfaces 8 ——————————————————————————————————————————————————————————————————————————————————————————————— Writing rendered image to file "../../../scenes\assignment3\constant-cornell-box-2024-10-15-14-50-13.png"... Writing rendered image to file "../../../scenes\assignment3\constant-cornell-box-2024-10-15-14-50-13.exr"... done! ``` before ``` Automatically setting number of threads in thread pool to 24. Reading "density" grid from NanoVDB file "D:\GitHub\cs87-fall-2024-blumenkranz07\build\Release\Release\..\..\..\scenes\final_project\volumes\double.nvdb" Loaded NanoVDB file "../../../scenes/final_project/volumes/double.nvdb" Reading "Cd" grid from NanoVDB file "D:\GitHub\cs87-fall-2024-blumenkranz07\build\Release\Release\..\..\..\scenes\final_project\volumes\double.nvdb" Loaded NanoVDB file "../../../scenes/final_project/volumes/double.nvdb" Color grid "Cd" successfully interpreted as Vec3f grid. World medium initialized Parsing scene ... Loading: ..\..\..\scenes\final_project\textures\Realistic Dusty Nebula 8k.hdr.hdr │█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████│ (909ms) registering material with name white registering material with name red registering material with name green registering material with name light registering material with name redsphere registering material with name greensphere Building BBH │██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████│ (0ms) BBH contains 8 surfaces. done parsing scene. Will save rendered image to "../../../scenes\final_project\constant-cornell-box-2024-11-25-22-19-28.png" Rendering │█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████│ (15.508s) ——————————————————————————————————————————————————————————————————————————————————————————————— Statistics: ——————————————————————————————————————————————————————————————————————————————————————————————— BBH Interior nodes 7 Leaf nodes 8 Nodes visited per ray 63094703 / 9133663 (6.91x) Integrator Camera rays traced 1638400 Intersections Quad intersection tests per hit 40201191 / 9124624 (4.41x) Sphere intersection tests per hit 7747230 / 668428 (11.59x) Total intersection tests per ray 47948421 / 9133663 (5.25x) Scene Materials 6 Surfaces 8 ——————————————————————————————————————————————————————————————————————————————————————————————— Saving raw image before denoising... Writing rendered image to file "../../../scenes\final_project\constant-cornell-box-2024-11-25-22-19-28.png"... Writing rendered image to file "../../../scenes\final_project\constant-cornell-box-2024-11-25-22-19-28.exr"... done! ``` after (#) Intel Open Denoise As my volume rendering has many noise, I decided to integrate denoising. Basically I followed the documentation. In its filter process, there are albedo and normal filters. As my scene is bascally volume, adding these filters would make the denoiser mistakenly recognize volume overlapping on the surface, which does not have a good effect. Therefore, I only used the basic filter. (#) Final Result
Before After
Before